<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="include/peizhi.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="${ctx}">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
        
        <%-- <link rel="stylesheet" type="text/css" href="<%=path%>/css/bootstrap.css" />
	    <link rel="stylesheet" type="text/css" href="<%=path%>/css/bootstrap-responsive.css" />
	    <link rel="stylesheet" type="text/css" href="<%=path%>/css/style.css" /> --%>
        <title>后台首页</title>
    </head>
    <body>
<div class="panel admin-panel">
  <div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 网站信息</strong></div>
  <div class="body-content">
    <form method="post" id='formAction' class="form-x" action="">
      <div class="form-group">
        <div class="label">
          <label>网站标题：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="title" value="${titleVo.title}" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>网站LOGO：</label>
        </div>
        <div class="field">
          <!-- <input type="text" id="url1" name="slogo" class="input tips" style="width:25%; float:left;" value="" data-toggle="hover" data-place="right" data-image=""  /> -->
          <input type="file" id='imageflle' class="button bg-blue margin-left" value="浏览上传" >
          <input type="button" class="button bg-blue margin-left" id="image1" value="确认上传" >
          <!-- <input type="text" style="display:none;" class="button bg-blue margin-left" id="imagezhanshi"  > -->
          <c:if test="${titleVo.logoSite!='' and titleVo.logoSite!=null}">
          		<div style="width: 100px;height: 100px" id="imagezhanshi" ><img src='${ctx}/upload/img/${titleVo.logoSite}' width='100px' height='100px'></div>
          </c:if>
          <c:if test="${titleVo.logoSite=='' or titleVo.logoSite==null}">
          		<div style="display:none;width: 100px;height: 100px" id="imagezhanshi" ></div>
          </c:if>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>网站域名：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="url" value="${titleVo.url}" />
        </div>
      </div>
      <!-- <div class="form-group" style="display:none">
        <div class="label">
          <label>副加标题：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="sentitle" value="" />
          <div class="tips"></div>
        </div>
      </div> -->
      <div class="form-group">
        <div class="label">
          <label>网站关键字：</label>
        </div>
        <div class="field">
          <textarea class="input" name="keyword"  style="height:80px">${titleVo.keyword}</textarea>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>网站描述：</label>
        </div>
        <div class="field">
          <textarea class="input" name="content">${titleVo.content}</textarea>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>联系人：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="name" value="${titleVo.name}" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>手机：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="phone" value="${titleVo.phone}" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>电话：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="tall" value="${titleVo.tall}" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group" style="display:none;">
        <div class="label">
          <label>400电话：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="talls" value="${titleVo.talls}" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>传真：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="tallBook" value="${titleVo.tallBook}" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>QQ：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="qq" value="${titleVo.qq}" />
          <div class="tips"></div>
        </div>
      </div>
      <!-- <div class="form-group" style="display:none">
        <div class="label">
          <label>QQ群：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="s_qqu" value="" />
          <div class="tips"></div>
        </div>
      </div> -->
     
      <div class="form-group">
        <div class="label">
          <label>Email：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="email" value="${titleVo.email}" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>地址：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="site" value="${titleVo.site}" />
          <div class="tips"></div>
        </div>
      </div>  
              
      <!-- <div class="form-group">
        <div class="label">
          <label>底部信息：</label>
        </div>
        <div class="field">
          <textarea name="scopyright" class="input" style="height:120px;"></textarea>
          <div class="tips"></div>
        </div>
      </div> -->
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button class="button bg-main icon-check-square-o" id='formSubmit' type="button"> 提交</button>
        </div>
      </div>
    </form>
  </div>
</div>
<script type="text/javascript">
	$("#image1").click(function(){
		//上传图片
		var fd = new FormData();
			fd.append("upload", 1);
			fd.append("image", $("#imageflle").get(0).files[0]);//id为上传图片的id字符串image应该是后台接收的对象
		$.ajax({
				url: "${ctx}/ht/index/image",
				type: "POST",
				processData: false,
				contentType: false,//禁止ajax识别类型
				data: fd,
				success: function(data) {
					//console.log(d);
					//background:url(icon.jpg) no-repeat left center; width:200px; height:30px;
					if(data!='' && data!=null){
						$("#imagezhanshi").show();
						$("#imagezhanshi").html("<img src='${ctx}/upload/img/logo.jpg' width='100px' height='100px'>");
						//$("#imagezhanshi").attr("style","background:url(${ctx}/upload/img/logo.jpg)no-repeat no-repeat center; width:200px; height:30px;");
					}else{
						alert("上传不成功请重新上传");
					}
				}
			});
		
	});
	$("#formSubmit").click(function(){
		$.ajax({
			url:"${ctx}/ht/index/indexHead",
			type:"post",
			data:$("#formAction").serialize(),
			success:function(data){
				if(data=='0'){
					alert("保存成功");
				}else if(data=='1'){
					alert("修改成功");
				}else{
					alert("操作失败");
				}
				
			}
		});
	});
</script>
</body>
</html>